while (TRUE)
{
- c = fgetc (magic_file);
+ c = getc_unlocked (magic_file);
if (c == EOF)
{
*end_of_file = TRUE;
while (TRUE)
{
- c = fgetc (magic_file);
+ c = getc_unlocked (magic_file);
if (c == EOF)
{
assert (magic_file != NULL);
assert (match != NULL);
- c = fgetc (magic_file);
+ c = getc_unlocked (magic_file);
if (c == EOF)
return XDG_MIME_MAGIC_EOF;
if (c != '[')
if (match->priority == -1)
return XDG_MIME_MAGIC_ERROR;
- c = fgetc (magic_file);
+ c = getc_unlocked (magic_file);
if (c == EOF)
return XDG_MIME_MAGIC_EOF;
if (c != ':')
while (1)
{
- c = fgetc (magic_file);
+ c = getc_unlocked (magic_file);
if (c == EOF)
return XDG_MIME_MAGIC_EOF;
if (c == '\n')
assert (magic_file != NULL);
/* Sniff the buffer to make sure it's a valid line */
- c = fgetc (magic_file);
+ c = getc_unlocked (magic_file);
if (c == EOF)
return XDG_MIME_MAGIC_EOF;
else if (c == '[')
return XDG_MIME_MAGIC_EOF;
if (indent == -1)
return XDG_MIME_MAGIC_ERROR;
- c = fgetc (magic_file);
+ c = getc_unlocked (magic_file);
if (c == EOF)
return XDG_MIME_MAGIC_EOF;
}
_xdg_mime_magic_matchlet_free (matchlet);
return XDG_MIME_MAGIC_ERROR;
}
- c = fgetc (magic_file);
+ c = getc_unlocked (magic_file);
if (c == EOF)
{
_xdg_mime_magic_matchlet_free (matchlet);
/* Next two bytes determine how long the value is */
matchlet->value_length = 0;
- c = fgetc (magic_file);
+ c = getc_unlocked (magic_file);
if (c == EOF)
{
_xdg_mime_magic_matchlet_free (matchlet);
matchlet->value_length = c & 0xFF;
matchlet->value_length = matchlet->value_length << 8;
- c = fgetc (magic_file);
+ c = getc_unlocked (magic_file);
if (c == EOF)
{
_xdg_mime_magic_matchlet_free (matchlet);
return XDG_MIME_MAGIC_ERROR;
}
- c = fgetc (magic_file);
+ c = getc_unlocked (magic_file);
if (c == '&')
{
matchlet->mask = malloc (matchlet->value_length);
else
return XDG_MIME_MAGIC_ERROR;
}
- c = fgetc (magic_file);
+ c = getc_unlocked (magic_file);
}
if (c == '~')
_xdg_mime_magic_matchlet_free (matchlet);
return XDG_MIME_MAGIC_ERROR;
}
- c = fgetc (magic_file);
+ c = getc_unlocked (magic_file);
}
if (c == '+')
_xdg_mime_magic_matchlet_free (matchlet);
return XDG_MIME_MAGIC_ERROR;
}
- c = fgetc (magic_file);
+ c = getc_unlocked (magic_file);
}
{
XdgMimeMagicMatchlet *new_list;
XdgMimeMagicMatchlet *tmp;
-
- if ((matchlets == NULL) || (matchlets->next == NULL))
+
+ if ((matchlets == NULL) || (matchlets->next == NULL))
return matchlets;
new_list = NULL;
tmp = matchlets;
- while (tmp != NULL)
+ while (tmp != NULL)
{
XdgMimeMagicMatchlet *matchlet;
}
return new_list;
-
+
}
static void
break;
case XDG_MIME_MAGIC_MAGIC:
state = _xdg_mime_magic_parse_magic_line (magic_file, match);
- if (state == XDG_MIME_MAGIC_SECTION)
+ if (state == XDG_MIME_MAGIC_SECTION ||
+ (state == XDG_MIME_MAGIC_EOF && match->mime_type))
{
match->matchlet = _xdg_mime_magic_matchlet_mirror (match->matchlet);
_xdg_mime_magic_insert_match (mime_magic, match);